#!/usr/env/bin python
# -*- coding: utf-8 -*-

# @Time    : 2020-10-26 9:28 上午
# @Author  : yangdy
# @File    : 2020-10-26.1365.有多少小于当前数字的数字
# @Software: PyCharmCE
from tools.my_methods import *


class Solution:
    def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]:
        ans = []
        c = [0 for i in range(101)]
        for x in nums:
            c[x] += 1
        for i in range(1, 101):
            c[i] += c[i-1]
        for i in range(len(nums)):
            ans.append(c[nums[i]-1] if nums[i] > 0 else 0)
        return ans
